<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
         Application["So_Nguoi_Online"] = 0;
         log4net.Config.XmlConfigurator.Configure();                
    }

    void Application_BeginRequest(object sender, EventArgs e)
    {
        
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown
        Application.Lock();

        Application["So_Nguoi_Online"] = int.Parse(Application["So_Nguoi_Online"].ToString()) - 1;

        Application.UnLock();
        
        
    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs
        //Response.Redirect("/vi.htm");
    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started
        Application.Lock();
        Application["So_Nguoi_Online"] = int.Parse(Application["So_Nguoi_Online"].ToString()) + 1;
        Application.UnLock();

        Framework.Module.Logging.Statistic.CMS_CounterDB objCounter = new Framework.Module.Logging.Statistic.CMS_CounterDB();
        objCounter.Update();
        

       
    }

    void Session_End(object sender, EventArgs e) 
    {
        Application.Lock();
        Application["So_Nguoi_Online"] = int.Parse(Application["So_Nguoi_Online"].ToString()) - 1;
        Application.UnLock();

    }
       
</script>
